#include "GnMainPCH.h"
#include "GnRenderer.h"

GnRenderer* GnRenderer::mspRenderer = NULL;
GnRenderer::GnRenderer(void)
{
}

GnRenderer::~GnRenderer(void)
{
}

GnRenderer::CreationParameters::CreationParameters(eRendererType rendererType, guint width,
	guint height, guint useflag, GnWindowHandle deviceHandle, GnWindowHandle focusHandle) :
	mRendererType(rendererType), mWidth(width), mHeight(height), mUseFlags(useflag),
	mDeviceHandle(deviceHandle), mFocusHandle(focusHandle), mCreate(NULL)
{
}

GnRenderer* GnRenderer::Create(CreationParameters* createParam)
{
	GnAssert( createParam->mCreate );
	mspRenderer = createParam->mCreate(createParam);
	if( !mspRenderer )
		return NULL;

	if( !mspRenderer->Init(createParam) )
	{
		GnDelete mspRenderer;
		return NULL;
	}
	return mspRenderer;
}
